package {
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import logout.pv.sceneloader.SceneLoader;
	import flash.display.StageQuality;
	import logout.scenes.panos.Panos;
	import flash.net.URLRequest;
	import flash.net.URLLoader;
	import logout.pv.scenes.AbstractScene;
	import org.papervision3d.Papervision3D;
	import d3s.net.papervision3d.objects.MotionCollada;
	import logout.scenes.got.GotScene;
	import logout.misc.PvWindow;
	import logout.level.AbstractLevel;
	import logout.scenes.got.GotLevel;
	import caurina.transitions.Tweener;
	import logout.scenes.hall.HallLevel;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	import logout.pv.factory.ObjectFactory;
	import bi.conf.Configuration;
	
	

	[ SWF( backgroundColor='0xffffff', frameRate='50', width="1000", height="800" )]
	public class Log_Out extends Sprite 
	{
		
		public function Log_Out()
		{
			addEventListener( Event.ADDED_TO_STAGE, onAdded );
		}
		
		private function onAdded( e : Event = null ) : void {
			
			//_________________________startApp
			var mainLayer : Sprite = addChild( new Sprite ) as Sprite;
			
			Application.start( mainLayer );
			
			
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.quality = StageQuality.MEDIUM;
			
			
			//stage.addEventListener( Event.RESIZE, onResize );
			
			//onResize();
			
			//startLevel();
			
		}
	
		
		/* private function startLevel(  ) :void {
			level = new GotLevel( "got" );
			//level = new HallLevel( levelsDatas.level.(@name == "hall" )[0] );
			addChild( level );
			addChild( new FPS() );
		} */
	
	
	
		// ____________________________________________________________________________DEBUG
		/* 
		private function testLevelDispose(  ) :void {
			//level = new GotLevel( levels.level.(@name == "got" )[0] );
			var t : Timer = new Timer( 4000 );
			t.addEventListener(TimerEvent.TIMER, startDlevel );
			t.start();
		}
		
		private function startDlevel( e: TimerEvent ) :void {
			
			if( r_or_d ) {
				trace("**************************************************************************************");
				trace("**************************************************************************************");
				trace("************                       DESTRUCTION TOTAL                   ***************");
				trace("**************************************************************************************");
				trace("**************************************************************************************");
				ObjectFactory.instance.dispose();
				SceneLoader.instance.dispose();
				if( level ) {
					removeChild( level );
					level.dispose();
				}
			}
			else {
				trace("**************************************************************************************");
				trace("**************************************************************************************");
				trace("************                           NEW LEVEL                       ***************");
				trace("**************************************************************************************");
				trace("**************************************************************************************");
			
				if( lId == 0 )
					level = addChild( new HallLevel( levelsDatas.level.(@name == "hall" )[0] ) ) as AbstractLevel;
				else
					level = addChild( new GotLevel( levelsDatas.level.(@name == "got" )[0] ) ) as AbstractLevel;
					
				lId++;
				if( lId > 1 ) lId = 0;
			}
			r_or_d = ! r_or_d;
		}
		
		private var lId : int = 1;
		private var r_or_d : Boolean = false;
		
		//______________________________________________________________________________
		
		private var level : AbstractLevel;
		private var levelsDatas : XML; */
	}
}
